<?
ob_start();
include("common/header.html");
include('common/autoload.php');
$out_html = ob_get_contents();
ob_end_clean();
echo $out_html;
$total_salerid = '';
if($_SESSION['dtype']==3){
    $sql = "select preSalerID from pft_terminal_share where nowSalerID={$_SESSION['saccount']}";
    $GLOBALS['le']->query($sql);
    while($row=$GLOBALS['le']->fetch_assoc()){
        $total_salerid .= $row['preSalerID'].',';
    }
    $sid = '';
    $total_salerid = rtrim($total_salerid,',');
}
//取景点
$land = array();
$land_json = "{title:'全部产品',id:1},";
include("/var/www/html/new/d/class/Member.php");
if($_SESSION['dtype']==2){
    $sql = "select id,title from uu_land where salerid={$_SESSION['account']}";
    $GLOBALS['le']->query($sql);
    while($row=$GLOBALS['le']->fetch_assoc()){
        $land_json .= "{title:'".$row['title']."',id:".$row['id']."},";
    }
}elseif($_SESSION['dtype']!=3){//管理员 供应商 分销商3
    if($_SESSION['sid']==1){
        $land_json .="{title:'近期新增产品总和(不支持客源地)',id:2},";
    }
    $m = new Member($s,$_SESSION['sid']);
    $sale = $m->salePros();
    $sort = array();
    foreach($sale as $v){
        $sort[] = mb_substr($v['title'],0,1,'UTF-8');
    }
    array_multisort($sort,SORT_ASC,$sale);
    foreach($sale as $v){
        if(!$land[$v['lid']]){
            $land[$v['lid']]= $v['title'];
            $land_json .="{title:'".$v['title']."',id:".$v['lid']."},";
        }
    }
}else{//dtype==3
    $sql = "select id,title from uu_land where salerid in ($total_salerid)";
    $GLOBALS['le']->query($sql);
    while($row=$GLOBALS['le']->fetch_assoc()){
        $land_json .= "{title:'".$row['title']."',id:".$row['id']."},";
    }
}
$land_json = rtrim($land_json,',');
echo "<script>
    var lands = {
        status: 'success',
        list: [
            ".$land_json."
        ]
    };
</script>";
include("tpl/orderReport_Com.tpl");
include("common/footer.html");
?>